package com.ruicar.afs.cloud.apply.pre.loan.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.apply.common.entity.ApplyCustContacts;
import com.ruicar.afs.cloud.apply.pre.loan.mapper.ApplyCustContactsMapper;
import com.ruicar.afs.cloud.apply.pre.loan.service.ApplyCustContactsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:联系人信息接口实现类
 * @Author:jihuigeng
 * @Date2020/5/15 19:02
 * @Version V1.0
 **/
@Service
public class ApplyCustContactsServiceImpl extends ServiceImpl<ApplyCustContactsMapper, ApplyCustContacts> implements ApplyCustContactsService {

    /**
     * 通过申请编号查询联系人信息
     *
     * @param applyNo
     * @return
     */
    public List<ApplyCustContacts> getCustContactsList(String applyNo) {
        List<ApplyCustContacts> contactsList = this.baseMapper.selectList(Wrappers.<ApplyCustContacts>query().lambda().eq(ApplyCustContacts::getApplyNo, applyNo));
        return contactsList;
    }

    @Override
    public ApplyCustContacts getCustContacts(String applyNo, String custRelation) {
        return this.baseMapper.selectOne(Wrappers.<ApplyCustContacts>query().lambda().eq(ApplyCustContacts::getApplyNo, applyNo).eq(ApplyCustContacts::getCustRelation,custRelation));
    }
}
